package com.stark.commons.spring.core.boot.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.Data;

/**
 * <code>Elasticsearch</code> 整合 <code>Search Guard</code> 配置项。
 * @author Ben
 * @since 1.0.0
 * @version 1.0.0
 */
@ConfigurationProperties(prefix = "spring.data.elasticsearch")
@Data
public class SearchGuardElasticsearchProperties {
	
	/** 集群名称，默认 elasticsearch */
	private String clusterName = "elasticsearch";

	/** 集群节点列表， {host:port} 以 "," 隔开 */
	private String clusterNodes;
	
	/** 自动发现集群节点 */
	private boolean clientTransportSniff = true;
	
	/** 不校验集群名称 */
	private boolean clientIgnoreClusterName = false;
	
	/** 连接超时时间 */
	private String clientPingTimeout = "5s";
	
	/** 心跳检测间隔时间 */
	private String clientNodesSamplerInterval = "5s";
	
	/** Search guard 配置项 */
	private SearchGuardProperties searchGuard = new SearchGuardProperties();

	/**
	 * Search Guard 配置项。
	 * @author Ben
	 * @since 1.0.0
	 * @version 1.0.0
	 */
	@Data
	public static class SearchGuardProperties {
		
		/** 临时文件目录 */
		private String tmpDir = "java.io.tmpdir";
		
	    private String sslTransportPemkeyFilepath;
	    
	    private String sslTransportPemcertFilepath;
	    
	    private String sslTransportPemtrustedcasFilepath;
	    
	    private String sslTransportPemkeyPassword;
	
	}

}
